﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPageAdmin.master" AutoEventWireup="true" CodeFile="Syllabus.aspx.cs" Inherits="Admin_Syllabus" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style8
        {
            font-weight: 700;
            text-align: center;
        }
        .style10
        {
            text-align: center;
        }
        .style11
        {
            width: 461px;
            text-align: right;
        }
        .style13
        {
            text-align: left;
        }
        .style14
        {
            text-align: left;
        }
        .style15
        {
            width: 461px;
            text-align: center;
            height: 23px;
        }
        .style16
        {
            height: 23px;
        }
        .style17
        {
            text-align: left;
            height: 23px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table class="style7">
        <tr>
            <td colspan="3" style="text-align: center; font-weight: 700">
                <asp:Label ID="Label1" runat="server" Text="Syllabus Managament" 
                    style="color: #0066FF"></asp:Label>
            </td>
        </tr>
        <tr>
            <td colspan="3">
                &nbsp;</td>
        </tr>
        <tr>
            <td colspan="3" style="text-align: center">
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                    AutoGenerateColumns="False" CellPadding="4" DataKeyNames="syllabusId" 
                    DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" 
                    onselectedindexchanged="GridView1_SelectedIndexChanged">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <asp:CommandField ShowSelectButton="True" />
                        <asp:BoundField DataField="syllabusId" HeaderText="Id" InsertVisible="False" 
                            ReadOnly="True" SortExpression="syllabusId" />
                        <asp:BoundField DataField="syllabusTitle" HeaderText="Title" 
                            SortExpression="syllabusTitle" />
                        <asp:BoundField DataField="filePath" HeaderText="File Path" 
                            SortExpression="filePath" />
                        <asp:BoundField DataField="uploadedDate" HeaderText="Uploaded Date" 
                            SortExpression="uploadedDate" />
                        <asp:BoundField DataField="uploadedUserId" HeaderText="Uploaded User Id" 
                            SortExpression="uploadedUserId" />
                        <asp:BoundField DataField="programId" HeaderText="Program Id" 
                            SortExpression="programId" />
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                    DeleteCommand="DELETE FROM [tblSyllabus] WHERE [syllabusId] = @syllabusId" 
                    InsertCommand="INSERT INTO [tblSyllabus] ([syllabusTitle], [filePath], [uploadedDate], [uploadedUserId], [programId]) VALUES (@syllabusTitle, @filePath, @uploadedDate, @uploadedUserId, @programId)" 
                    SelectCommand="SELECT * FROM [tblSyllabus]" 
                    UpdateCommand="UPDATE [tblSyllabus] SET [syllabusTitle] = @syllabusTitle, [filePath] = @filePath, [uploadedDate] = @uploadedDate, [uploadedUserId] = @uploadedUserId, [programId] = @programId WHERE [syllabusId] = @syllabusId">
                    <DeleteParameters>
                        <asp:ControlParameter ControlID="txtId" Name="syllabusId" PropertyName="Text" 
                            Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:ControlParameter ControlID="txtId" Name="syllabusId" PropertyName="Text" 
                            Type="Int32" />
                        <asp:ControlParameter ControlID="txtTitle" Name="syllabusTitle" 
                            PropertyName="Text" Type="String" />
                        <asp:ControlParameter ControlID="fulFilePath" Name="filePath" 
                            PropertyName="FileName" Type="String" />
                        <asp:ControlParameter ControlID="Calendar1" Name="uploadedDate" 
                            PropertyName="SelectedDate" Type="DateTime" />
                        <asp:ControlParameter ControlID="ddlUserId" Name="uploadedUserId" 
                            PropertyName="SelectedValue" Type="Int32" />
                        <asp:ControlParameter ControlID="ddlProgramId" Name="programId" 
                            PropertyName="SelectedValue" Type="Int32" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:Parameter Name="syllabusTitle" Type="String" />
                        <asp:Parameter Name="filePath" Type="String" />
                        <asp:Parameter Name="uploadedDate" Type="DateTime" />
                        <asp:Parameter Name="uploadedUserId" Type="Int32" />
                        <asp:Parameter Name="programId" Type="Int32" />
                    </InsertParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td class="style10" colspan="3">
                <asp:Button ID="btnAdd" runat="server" Text="Add" onclick="btnAdd_Click" />
&nbsp;
                <asp:Button ID="btnEdit" runat="server" Text="Edit" onclick="btnEdit_Click" />
&nbsp;&nbsp;
                <asp:Button ID="btnDelete" runat="server" Text="Delete" 
                    onclick="btnDelete_Click" />
            </td>
        </tr>
        <tr>
            <td class="style15">
                </td>
            <td class="style16">
                </td>
            <td class="style17">
                </td>
        </tr>
        <tr>
            <td class="style8" colspan="3">
                <asp:Label ID="Label8" runat="server" style="color: #0066FF" Text="Edit" 
                    Visible="False"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style11">
                <asp:Label ID="Label2" runat="server" Text="Id" Visible="False"></asp:Label>
            </td>
            <td>
                &nbsp;</td>
            <td class="style13">
                <asp:TextBox ID="txtId" runat="server" Visible="False"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style11">
                <asp:Label ID="Label3" runat="server" Text="Title" Visible="False"></asp:Label>
            </td>
            <td>
                &nbsp;</td>
            <td class="style13">
                <asp:TextBox ID="txtTitle" runat="server" Visible="False"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style11">
                <asp:Label ID="Label4" runat="server" Text="File Path" Visible="False"></asp:Label>
            </td>
            <td>
                &nbsp;</td>
            <td class="style13">
                <asp:FileUpload ID="fulFilePath" runat="server" Visible="False" />
            </td>
        </tr>
        <tr>
            <td class="style11">
                <asp:Label ID="Label5" runat="server" Text="Upload date" Visible="False"></asp:Label>
            </td>
            <td>
                &nbsp;</td>
            <td class="style14">
                <asp:Calendar ID="Calendar1" runat="server" style="text-align: center" 
                    Visible="False"></asp:Calendar>
            </td>
        </tr>
        <tr>
            <td class="style11">
                <asp:Label ID="Label6" runat="server" Text="Upload User Id" Visible="False"></asp:Label>
            </td>
            <td>
                &nbsp;</td>
            <td class="style14">
                <asp:DropDownList ID="ddlUserId" runat="server" Visible="False">
                    <asp:ListItem></asp:ListItem>
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem>2</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style11">
                <asp:Label ID="Label7" runat="server" Text="Program Id" Visible="False"></asp:Label>
            </td>
            <td>
                &nbsp;</td>
            <td class="style14">
                <asp:DropDownList ID="ddlProgramId" runat="server" 
                    DataSourceID="SqlDataSource2" DataTextField="programId" 
                    DataValueField="programId" Visible="False">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                    SelectCommand="SELECT [programId] FROM [tblProgram]"></asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td class="style13" colspan="3">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style13" colspan="3">
                <asp:Button ID="btnEdit1" runat="server" onclick="btnEdit1_Click" Text="Edit" 
                    Visible="False" />
            </td>
        </tr>
    </table>
</asp:Content>

